
package cn.nubia.admin.application.bean;

import cn.nubia.admin.common.mybatis.annotations.Column;
import cn.nubia.admin.common.mybatis.annotations.Id;
import cn.nubia.admin.common.mybatis.annotations.Table;
import cn.nubia.admin.common.mybatis.annotations.UnColumn;
import cn.nubia.admin.common.utils.DateUtil;

import java.io.Serializable;
import java.util.Date;

/**
 * Created by justin on 15/6/30.
 * CREATE TABLE `nb_ad_item` (
 * `ad_item_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '广告id',
 * `ad_item_title` varchar(50) DEFAULT NULL COMMENT '广告标题',
 * `ad_space_id` int(11) DEFAULT NULL COMMENT '广告位id',
 * `state` smallint(6) DEFAULT NULL COMMENT '状态（-1-删除 0-隐藏 1-显示）',
 * `create_time` int(11) DEFAULT NULL COMMENT '创建时间',
 * `resource_type` int(11) DEFAULT NULL COMMENT '资源类型（1-软件详情 2-软件分类 3-专题 4-外链）',
 * `resource_value` int(11) DEFAULT NULL COMMENT '资源值(软件id、分类id、专题id）',
 * `create_admin_id` int(11) DEFAULT NULL COMMENT '创建管理员id',
 * `expired_time` int(11) DEFAULT NULL COMMENT '广告过期时间',
 * `start_time` int(11) DEFAULT NULL COMMENT '广告开始时间',
 * `sort_index` int(11) DEFAULT NULL COMMENT '排序号',
 * `link_url` varchar(200) DEFAULT NULL COMMENT '外链',
 * `create_admin_id2` int(11) DEFAULT NULL COMMENT '创建人的管理员id',
 * `create_admin_name` varchar(20) DEFAULT NULL COMMENT '创建人的管理员名称',
 * `modify_admin_id` int(11) DEFAULT NULL COMMENT '修改人的管理员id',
 * `modify_admin_name` varchar(20) DEFAULT NULL COMMENT '修改人的管理员名称',
 * `last_modify_time` int(11) DEFAULT NULL COMMENT '最后修改时间',
 * PRIMARY KEY (`ad_item_id`),
 * KEY `FK_Reference_18` (`ad_space_id`),
 * CONSTRAINT `FK_Reference_18` FOREIGN KEY (`ad_space_id`) REFERENCES `nb_ad_space` (`ad_space_id`)
 * ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='广告内容';
 */
//广告内容对象.
@Table(value = "nb_ad_item")
public class AdItem implements Serializable {

    private static final long serialVersionUID = -8244661101951482489L;

    public static final String COLUMN_STATE  ="state";

    public static final int STATE_DEL = -1;

    public static final int STATE_HIDDEN = 0;

    public static final int STATE_SHOW = 1;
    @Id(value = "ad_item_id")
    private Integer id;
    private String adItemTitle;//广告标题
    private Integer adSpaceId;//广告位id
    private Integer state;//状态（-1-删除 0-隐藏 1-显示）
    private Integer createTime;//创建时间
    private Integer resourceType;//资源类型（1-软件详情 2-软件分类 3-专题 4-外链）
    private Integer resourceValue;//资源值(软件id、分类id、专题id）
    private Integer createAdminId;//创建管理员id
    private Integer expiredTime;//广告过期时间
    private Integer startTime;//广告开始时间
    private Integer sortIndex;//排序号
    private String linkUrl;//外链
    private String createAdminName;//创建人的管理员名称
    private Integer modifyAdminId;//修改人的管理员id
    private String modifyAdminName;//修改人的管理员名称
    private Integer lastModifyTime;//最后修改时间
    @UnColumn
    private Date startDate;
    @UnColumn
    private Date expiredDate;

    @UnColumn
    private String createTimeShow;
    @UnColumn
    private String expiredTimeShow;
    @UnColumn
    private String startTimeShow;

    private String imageUrl; //广告图

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getAdItemTitle() {
        return adItemTitle;
    }

    public void setAdItemTitle(String adItemTitle) {
        this.adItemTitle = adItemTitle;
    }

    public Integer getAdSpaceId() {
        return adSpaceId;
    }

    public void setAdSpaceId(Integer adSpaceId) {
        this.adSpaceId = adSpaceId;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public Integer getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Integer createTime) {
        this.createTime = createTime;
        if(createTime!=null && !"".equals(createTime)){
            this.createTimeShow = DateUtil.getFormatDate(createTime);
        }
    }

    public Integer getResourceType() {
        return resourceType;
    }

    public void setResourceType(Integer resourceType) {
        this.resourceType = resourceType;
    }

    public Integer getResourceValue() {
        return resourceValue;
    }

    public void setResourceValue(Integer resourceValue) {
        this.resourceValue = resourceValue;
    }

    public Integer getCreateAdminId() {
        return createAdminId;
    }

    public void setCreateAdminId(Integer createAdminId) {
        this.createAdminId = createAdminId;
    }

    public Integer getExpiredTime() {
        return expiredTime;
    }

    public void setExpiredTime(Integer expiredTime) {
        this.expiredTime = expiredTime;
        if(expiredTime!=null && !"".equals(expiredTime)){
            this.expiredTimeShow = DateUtil.getFormatDate(expiredTime);
        }
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
        if(startDate!=null && !"".equals(startDate)){
            this.startTime = DateUtil.getIntegerTime(startDate);
        }
    }


    public Date getExpiredDate() {
        return expiredDate;
    }

    public void setExpiredDate(Date expiredDate) {
        this.expiredDate = expiredDate;
        if(expiredDate!=null && !"".equals(expiredDate)){
            this.expiredTime = DateUtil.getIntegerTime(expiredDate);
        }
    }

    public Integer getStartTime() {
        return startTime;
    }

    public void setStartTime(Integer startTime) {
        this.startTime = startTime;
        if(startTime!=null && !"".equals(startTime)){
            this.startTimeShow = DateUtil.getFormatDate(startTime);
        }
    }

    public Integer getSortIndex() {
        return sortIndex;
    }

    public void setSortIndex(Integer sortIndex) {
        this.sortIndex = sortIndex;
    }

    public String getLinkUrl() {
        return linkUrl;
    }

    public void setLinkUrl(String linkUrl) {
        this.linkUrl = linkUrl;
    }

    public String getCreateAdminName() {
        return createAdminName;
    }

    public void setCreateAdminName(String createAdminName) {
        this.createAdminName = createAdminName;
    }

    public Integer getModifyAdminId() {
        return modifyAdminId;
    }

    public void setModifyAdminId(Integer modifyAdminId) {
        this.modifyAdminId = modifyAdminId;
    }

    public String getModifyAdminName() {
        return modifyAdminName;
    }

    public void setModifyAdminName(String modifyAdminName) {
        this.modifyAdminName = modifyAdminName;
    }

    public Integer getLastModifyTime() {
        return lastModifyTime;
    }

    public void setLastModifyTime(Integer lastModifyTime) {
        this.lastModifyTime = lastModifyTime;
    }

    public String getCreateTimeShow() {
        return createTimeShow;
    }

    public void setCreateTimeShow(String createTimeShow) {
        this.createTimeShow = createTimeShow;

    }

    public String getExpiredTimeShow() {
        return expiredTimeShow;
    }

    public void setExpiredTimeShow(String expiredTimeShow) {
        this.expiredTimeShow = expiredTimeShow;
    }

    public String getStartTimeShow() {
        return startTimeShow;
    }

    public void setStartTimeShow(String startTimeShow) {
        this.startTimeShow = startTimeShow;
    }

    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }
}
